package com.fenghongzhang.kotlin1903.mvp.model

import android.util.Log
import com.fenghongzhang.kotlin1903.api.FoodApi
import com.fenghongzhang.kotlin1903.model.Food
import com.fenghongzhang.kotlin1903.mvp.contract.FoodContract
import com.fenghongzhang.kotlin1903.util.RetrofitManager
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers

class FoodModel : FoodContract.IFoodModel{

    override fun getFoodData(observer: Observer<Food>) {
        RetrofitManager.getRetrofit().create(FoodApi::class.java)
            .getFood()
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(observer)
    }

    override fun destroy() {

    }


}